<!--
  /**
   * 组织树形下拉选择组件：继承自树形下拉选择组件
   * @see @/components/TreeSelect
   * 使用方法
   * <human-organize-chooser v-model="form.entry.parentId" :readonly="!form.editable" :disabled="!form.editable"></human-organize-chooser>
   */
-->
<script>

import TreeSelect from "@/components/TreeSelect"
import *  as humanOrganizeApi from '../apis/organize'

export default {
  extends: TreeSelect,
  name: 'humanOrganizeChooser',
  props: {
  nodeProps: {
    type: Object, default() {
    return {children: 'children', label: 'name',}
    }
  },
  nodeKey: {
    type: String, default() {
    return 'id'
    }
  },
  },
  data() {
  return {
    treeData: []
  };
  },
  created() {
  this.loadData()
  },
  mounted() {
  },
  methods: {
  loadData() {
    if (!this.nodeData.length) {
    humanOrganizeApi.tree().then(response => {
      if (response.status === 200) {
      //this.treeData = this.$utils.listConvertTree(response.result)
      this.$set(this, "treeData", this.$utils.listConvertTree(response.result))
      //this.handleSelectedKey()
      }
    })
    }
  }
  },
};
</script>

